package java6681.lesson14;

class 形状{
    public void draw(){}
}
class 圆 extends 形状{
    @Override
    public void draw() {
        System.out.println("正在画圆...");
    }
}
class 矩形 extends 形状{
    @Override
    public void draw() {
        System.out.println("正在画矩形...");
    }
}
class 三角形 extends 形状{
    @Override
    public void draw() {
        System.out.println("正在画三角形...");
    }
}
class 梯形 extends 形状{
    @Override
    public void draw() {
        System.out.println("正在画梯形...");
    }
}
class 画图器{
    public static void drawAll(形状[] shapes){
        for (int i = 0; i < shapes.length; i++) {
            shapes[i].draw();
        }
    }
}
public class ShapeDemo {
    public static void main(String[] args) {
        形状 sh = new 圆();
        sh.draw();
        sh = new 三角形();
        sh.draw();
        形状[] shapes = new 形状[]{new 圆(),new 三角形(),new 圆(),new 矩形(),new 梯形()};
        画图器.drawAll(shapes);
    }
}
